import cv2
import numpy as np
import torch
import torchvision.transforms as transforms
import os
from models.dvg.network import LightCNN_29v2

def define_lightcnn(opt):
    # opt.numclass=3
    return LightCNN_29v2(opt)

# def load_model(model,pth_path):
#     return None
# def get_loss():
#     return torch.nn.CrossEntropyLoss()
# def get_npoints():
#     return None
# def predeal(data,config=None):
#     T = transforms.ToTensor()
#     return T(data).unsqueeze(0)
# def resdeal(data,config=None):
#     T = transforms.ToPILImage()
#     # data = data.permute(0,2,3,1)[0].detach().cpu().numpy()[:,:,0]
#     # data = (255*(data-data.min())/(data.max()-data.min())).astype(np.uint8)[:,:,0]
#     return cv2.cvtColor(np.asarray(T(data.cpu()[0,:,:,:])),cv2.COLOR_RGB2BGR)

# def load_model(model,pth_path):
#     checkpoint=None
#     if os.path.exists(pth_path):
#         checkpoint = torch.load(os.path.join(pth_path))
#         model.load_state_dict(checkpoint['state_dict'])
#     return checkpoint
# def execdeal(model,data,config=None):
#     return model(data)